<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="css/base.css">
    <link rel="stylesheet" href="font/iconfont.css">
    <link rel="stylesheet" href="css/swiper.min.css">
    <link rel="stylesheet" href="css/site.css">
    <script src="js/viewport.js"></script>
    <script src="js/swiper.min.js"></script>
    <script src="js/jquery-1.8.3.js"></script>
    <script src="js/public.js"></script>
    <script src="js/vue.min.js"></script>
    <script src="js/axios.js"></script>
    <script src="js/qs.js"></script>
</head>

<body>
<div id="app">
    <header class="padding-35">
        <div class="logo">
            <img src="imgs/logo.png" alt="">
        </div>
        <div class="menu">
            <img src="imgs/menu.png" alt="">
        </div>
    </header>
    <div class="mbx padding-35">
        <a href="index.html">健康美食网</a>
        <i class="iconfont icon-arrow-right-copy-copy"></i>
        <span>全部菜谱</span>
    </div>
    <div class="foodDetail padding-35">
        <div class="foodDetailTit">
            <img :src="food.fimg" alt="" style="width: 200px;height: 150px">
            <br>
            <span>{{food.fname}}</span>
        </div>
        <div class="foodDetailCon">
            <div class="foodDetailConTit">
                <span>{{food.fname}}简介</span>
            </div>
            <div class="foodDetailConBox">
                {{food.fintroduce}}
            </div>
        </div>
        <div class="foodDetailCon">
            <div class="foodDetailConTit">
                <span>营养功效</span>
            </div>
            <div class="foodDetailConBox anthorConBox">
                {{food.fnutrition}}
            </div>
        </div>
        <div class="foodDetailCon">
            <div class="foodDetailConTit">
                <span>食用宜忌</span>
            </div>
            <div class="foodYi">
                <span>宜</span>
                <i></i>
            </div>
            <div class="foodDetailConBox anthorConBox">
                {{food.fwell}}
            </div>
            <div class="foodYi foodJi">
                <span>忌</span>
                <i></i>
            </div>
            <div class="foodDetailConBox anthorConBox">
                {{food.fbad}}
            </div>
        </div>
        <div class="foodDetailCon">
            <div class="foodDetailConTit">
                <span>选购技巧</span>
            </div>
            <div class="foodDetailConBox">
                {{food.fskill}}
            </div>
        </div>
    </div>
    <footer>
        <p>版权所有：版权所有：健康美食网 WWW.JKMEISHI.COM</p>
        <p>Copyright 2011-2018 备案号:鄂ICP备11013833号-4</p>
    </footer>
</div>
<script>
    var url = decodeURI(window.location.href);
    console.log(url);
    // var backToPreUrl = url.split("?");
    // console.log(backToPreUrl);
    // console.log(backToPreUrl[1]);

    var backToPreUrl = url.split("=");
    var id = backToPreUrl[1];
    console.log(id)
    var v = new Vue({
        el : "#app",
        data : {
            cid : "",
            food : {}
        },
        created(){
            this.queryById();
        },
        methods:{
            queryById(){
                this.cid=id;
                console.log(this.cid);
                axios.post("healthy/food/querybyId",qs.stringify({id:this.cid})).then(res=>{
                    this.food = res.data.data;
                    console.log(this.food);
                })
            }
        }
    })
</script>
</body>

</html>